package com.asset.crm.client;

import java.util.ArrayList;
import java.util.List;

import com.asset.crm.client.Messages;
import com.google.gwt.core.client.GWT;

public class ValidateSampleModule {
	private static final Messages messages = GWT.create(Messages.class);
	public static List<String> errors= new ArrayList<String>();
	public static void messageProxy(String contact ,String errorMessage) {
		if(errorMessage.equalsIgnoreCase("contact")){
			validateNullValuesContact(contact,errorMessage);
		}
		else if(errorMessage.equalsIgnoreCase("invoice")){
			validateNullValuesContact(contact,errorMessage);
		}
	}
	
	private static Boolean validateNullValuesContact(String contactName,String errorMessage ) {
		if(contactName == null && contactName.trim().equalsIgnoreCase("") && contactName.isEmpty()){
			errors.add(messages.errorContact());
			return false;
		}
		else{
			return	true;
		}
			
	}
	private static Boolean validateNullValuesInvoice(String contactName,String errorMessage ) {
		if(contactName == null && contactName.trim().equalsIgnoreCase("") && contactName.isEmpty()){
			errors.add(messages.errorInvoiceNumber());
			return false;
		}
		else{
			return	true;
		}
			
	}
}